/**
 * 
 */
package com.cuc.platform.core.componet.security.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author peepul
 * 
 * 系统认证资源类
 * 
 * ss_resc表的对应POJO
 */
public class SecurityResource implements Serializable {
	
	private static final long serialVersionUID = -1330049214125528308L;
	
	private Long id;//pk
	private String name;
	
	/**
	 * 资源类型，URL还是METHOD
	 * 
	 * URL支持通配符
	 */
	private String res_type;
	
	private String res_string;
	private Integer priority;//优先级排序
	private String descn;
	
	private List<SecurityAuthority> auths = new ArrayList<SecurityAuthority>();
	
	/**
	 * @return the auths
	 */
	public List<SecurityAuthority> getAuths() {
		return auths;
	}
	/**
	 * @param auths the auths to set
	 */
	public void setAuths(List<SecurityAuthority> auths) {
		this.auths = auths;
	}
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the res_type
	 */
	public String getRes_type() {
		return res_type;
	}
	/**
	 * @param res_type the res_type to set
	 */
	public void setRes_type(String res_type) {
		this.res_type = res_type;
	}
	/**
	 * @return the res_string
	 */
	public String getRes_string() {
		return res_string;
	}
	/**
	 * @param res_string the res_string to set
	 */
	public void setRes_string(String res_string) {
		this.res_string = res_string;
	}
	/**
	 * @return the priority
	 */
	public Integer getPriority() {
		return priority;
	}
	/**
	 * @param priority the priority to set
	 */
	public void setPriority(Integer priority) {
		this.priority = priority;
	}
	/**
	 * @return the descn
	 */
	public String getDescn() {
		return descn;
	}
	/**
	 * @param descn the descn to set
	 */
	public void setDescn(String descn) {
		this.descn = descn;
	}
	/**
	 * 
	 */
	public SecurityResource() {
		super();
	}
	/**
	 * @param id
	 * @param name
	 * @param res_type
	 * @param res_string
	 * @param priority
	 * @param descn
	 */
	public SecurityResource(Long id, String name, String res_type,
			String res_string, Integer priority, String descn) {
		super();
		this.id = id;
		this.name = name;
		this.res_type = res_type;
		this.res_string = res_string;
		this.priority = priority;
		this.descn = descn;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((descn == null) ? 0 : descn.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((priority == null) ? 0 : priority.hashCode());
		result = prime * result
				+ ((res_string == null) ? 0 : res_string.hashCode());
		result = prime * result
				+ ((res_type == null) ? 0 : res_type.hashCode());
		return result;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SecurityResource other = (SecurityResource) obj;
		if (descn == null) {
			if (other.descn != null)
				return false;
		} else if (!descn.equals(other.descn))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (priority == null) {
			if (other.priority != null)
				return false;
		} else if (!priority.equals(other.priority))
			return false;
		if (res_string == null) {
			if (other.res_string != null)
				return false;
		} else if (!res_string.equals(other.res_string))
			return false;
		if (res_type == null) {
			if (other.res_type != null)
				return false;
		} else if (!res_type.equals(other.res_type))
			return false;
		return true;
	}
	
	
	
}
